🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / androidApp / src / fdroid / kotlin / org / meshtastic / app / map / SqlTileWriterExt.kt
Displaying Raw • Download
androidApp/src/fdroid/kotlin/org/meshtastic/app/map/SqlTileWriterExt.kt 9d416855dd1d2074b5dbb5ad40e7e954246afcdf (9d416855) Text, 3.92 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.app.map
Tff7b72import T7ee787android.database.Cursor
Tff7b72import T7ee787org.meshtastic.core.common.util.nowMillis
Tff7b72import T7ee787org.osmdroid.tileprovider.modules.DatabaseFileArchive
Tff7b72import T7ee787org.osmdroid.tileprovider.modules.SqlTileWriter
T8b949e/**
* Extended the sqlite tile writer to have some additional query functions. A this point it's unclear if there is a need
* to put these with the osmdroid-android library, thus they were put here as more of an example.
*
* created on 12/21/2016.
*
* @author Alex O'Ree
* @since 5.6.2
*/
Tff7b72class T56d364SqlTileWriterExt Tb4b4b4: Te6edf3SqlTileWriterTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72fun Td2a8ffselectTb4b4b4(Te6edf3rowsTb4b4b4: Tffa657IntTb4b4b4, Te6edf3offsetTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Te6edf3Cursor? Tff7b72= Tff7b72thisTb4b4b4.Te6edf3dbTff7b72?.Te6edf3rawQueryTb4b4b4(
Ta5d6ff"Ta5d6ffselect Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3COLUMN_KEY Tff7b72+
Ta5d6ff"Ta5d6ff,Ta5d6ff" Tff7b72+
Te6edf3COLUMN_EXPIRES Tff7b72+
Ta5d6ff"Ta5d6ff,Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3COLUMN_PROVIDER Tff7b72+
Ta5d6ff"Ta5d6ff from Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3TABLE Tff7b72+
Ta5d6ff"Ta5d6ff limit ? offset ?Ta5d6ff"Tb4b4b4,
Te6edf3arrayOfTb4b4b4(Te6edf3rowsTb4b4b4.Te6edf3toStringTb4b4b4(Tb4b4b4) Tff7b72+ Ta5d6ff"Ta5d6ff"Tb4b4b4, Te6edf3offsetTb4b4b4.Te6edf3toStringTb4b4b4(Tb4b4b4) Tff7b72+ Ta5d6ff"Ta5d6ff"Tb4b4b4)Tb4b4b4,
Tb4b4b4)
T8b949e/**
* gets all the tiles sources that we have tiles for in the cache database and their counts
*
* @return
*/
Tff7b72val Te6edf3sourcesTb4b4b4: Te6edf3ListTff7b72<Te6edf3SourceCountTff7b72>
Tff7b72getTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3db Tff7b72= Te6edf3db
Tff7b72val Te6edf3retTb4b4b4: Te6edf3MutableListTff7b72<Te6edf3SourceCountTff7b72> Tff7b72= Te6edf3ArrayListTb4b4b4(Tb4b4b4)
Tff7b72if Tb4b4b4(Te6edf3db Tff7b72=Tff7b72= Tff7b72nullTb4b4b4) Tb4b4b4{
Tff7b72return Te6edf3ret
Tb4b4b4}
Tff7b72var Te6edf3curTb4b4b4: Te6edf3Cursor? Tff7b72= Tff7b72null
Tff7b72try Tb4b4b4{
Te6edf3cur Tff7b72=
Te6edf3dbTb4b4b4.Te6edf3rawQueryTb4b4b4(
Ta5d6ff"Ta5d6ffselect Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3COLUMN_PROVIDER Tff7b72+
Ta5d6ff"Ta5d6ff,count(*) Ta5d6ff" Tff7b72+
Ta5d6ff"Ta5d6ff,min(length(Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3COLUMN_TILE Tff7b72+
Ta5d6ff"Ta5d6ff)) Ta5d6ff" Tff7b72+
Ta5d6ff"Ta5d6ff,max(length(Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3COLUMN_TILE Tff7b72+
Ta5d6ff"Ta5d6ff)) Ta5d6ff" Tff7b72+
Ta5d6ff"Ta5d6ff,sum(length(Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3COLUMN_TILE Tff7b72+
Ta5d6ff"Ta5d6ff)) Ta5d6ff" Tff7b72+
Ta5d6ff"Ta5d6fffrom Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3TABLE Tff7b72+
Ta5d6ff"Ta5d6ff Ta5d6ff" Tff7b72+
Ta5d6ff"Ta5d6ffgroup by Ta5d6ff" Tff7b72+
Te6edf3DatabaseFileArchiveTb4b4b4.Te6edf3COLUMN_PROVIDERTb4b4b4,
Tff7b72nullTb4b4b4,
Tb4b4b4)
Tff7b72while Tb4b4b4(Te6edf3curTb4b4b4.Te6edf3moveToNextTb4b4b4(Tb4b4b4)Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3c Tff7b72= Te6edf3SourceCountTb4b4b4(Tb4b4b4)
Te6edf3cTb4b4b4.Te6edf3source Tff7b72= Te6edf3curTb4b4b4.Te6edf3getStringTb4b4b4(T79c0ff0Tb4b4b4)
Te6edf3cTb4b4b4.Te6edf3rowCount Tff7b72= Te6edf3curTb4b4b4.Te6edf3getLongTb4b4b4(T79c0ff1Tb4b4b4)
Te6edf3cTb4b4b4.Te6edf3sizeMin Tff7b72= Te6edf3curTb4b4b4.Te6edf3getLongTb4b4b4(T79c0ff2Tb4b4b4)
Te6edf3cTb4b4b4.Te6edf3sizeMax Tff7b72= Te6edf3curTb4b4b4.Te6edf3getLongTb4b4b4(T79c0ff3Tb4b4b4)
Te6edf3cTb4b4b4.Te6edf3sizeTotal Tff7b72= Te6edf3curTb4b4b4.Te6edf3getLongTb4b4b4(T79c0ff4Tb4b4b4)
Te6edf3cTb4b4b4.Te6edf3sizeAvg Tff7b72= Te6edf3cTb4b4b4.Te6edf3sizeTotal Tff7b72/ Te6edf3cTb4b4b4.Te6edf3rowCount
Te6edf3retTb4b4b4.Te6edf3addTb4b4b4(Te6edf3cTb4b4b4)
Tb4b4b4}
Tb4b4b4} Tff7b72catch Tb4b4b4(Te6edf3eTb4b4b4: Te6edf3ExceptionTb4b4b4) Tb4b4b4{
Te6edf3catchExceptionTb4b4b4(Te6edf3eTb4b4b4)
Tb4b4b4} Tff7b72finally Tb4b4b4{
Te6edf3curTff7b72?.Te6edf3closeTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tff7b72return Te6edf3ret
Tb4b4b4}
Tff7b72val Te6edf3rowCountExpiredTb4b4b4: Tffa657Long
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3getRowCountTb4b4b4(Ta5d6ff"Tffd700$Te6edf3COLUMN_EXPIRESTa5d6ff<?Ta5d6ff"Tb4b4b4, Te6edf3arrayOfTb4b4b4(Te6edf3nowMillisTb4b4b4.Te6edf3toStringTb4b4b4(Tb4b4b4)Tb4b4b4)Tb4b4b4)
Tff7b72class T56d364SourceCount Tb4b4b4{
Tff7b72var Te6edf3rowCountTb4b4b4: Tffa657Long Tff7b72= T79c0ff0
Tff7b72var Te6edf3sourceTb4b4b4: Tffa657String? Tff7b72= Tff7b72null
Tff7b72var Te6edf3sizeTotalTb4b4b4: Tffa657Long Tff7b72= T79c0ff0
Tff7b72var Te6edf3sizeMinTb4b4b4: Tffa657Long Tff7b72= T79c0ff0
Tff7b72var Te6edf3sizeMaxTb4b4b4: Tffa657Long Tff7b72= T79c0ff0
Tff7b72var Te6edf3sizeAvgTb4b4b4: Tffa657Long Tff7b72= T79c0ff0
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s